package com.source.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 资源的路径映射配置类
 * 根据不同的运行系统进行不一样的配置，这里主要示分为window系统和其他（Linux）
 * @author fengq
 */
@Configuration
public class ImageConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        String os = System.getProperty("os.name");
        if (os.toLowerCase().startsWith("win")){
            registry.addResourceHandler("/image/**").addResourceLocations("file:C:/user/lightfowl/image/");
        }else {
            registry.addResourceHandler("/image/**").addResourceLocations("file:/user/lightfowl/image/");
        }

    }


}